package com.sxf.auth.attach;

import com.sxf.common.param.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author liu.chunhui
 * @version 1.0
 * @description
 * @date 2024/4/15 22:32:19
 */
@RestController
@Api(value = "附件上传", tags = { "附件上传" })
@Validated
@RequestMapping("/attach")
public class AttachController {

    @Autowired
    AttachService attachService;

    @ApiOperation(value = "上传附件", produces = "multipart/form-data", httpMethod = "POST")
    @PostMapping("/upload")
    public ResultInfo<String> uploadFile(@RequestParam MultipartFile file){
        return ResultInfo.success(attachService.uploadFile(file));
    }
}
